#include<iostream>
#include<vector>
using namespace std;
vector<int> query;
void query_push(int m)
{
    query.push_back(m);
}
void query_print(int m)
{
    cout<<query[m]<<'\n';
}
void query_erase()
{
    query.pop_back();
}
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int m;
        cin>>m;
        if(m==0)
        {
            int x;
            cin>>x;
            query_push(x);
        }
        else if(m==1)
        {
            int x;
            cin>>x;
            query_print(x);
        }
        else
        {
            query_erase();
        }
    }
}